<include file="Public/head" />
<style type="text/css">
    .focus-btn,.new_carousel_btn{width:80px;border-radius: 3px;color: #fff;margin-left: 7px;padding: 0;background-color: #20ab4f;border: medium none;}
    .chenggong1 .paidan{padding-top:30px;}
    .paidan h3{font-size:16px;color:#000;margin-bottom: 30px;}
    #driver{
         -moz-appearance: none;background: rgba(0, 0, 0, 0) url("http://img2.isou365.cn/paimai/yunying/images/sanjiao.jpg") no-repeat scroll 130px 5px;border: 1px solid #d7d7d7;color: #666;float: left;
    font-family: "微软雅黑";font-size: 12px;height: 26px;line-height: 26px;margin: 0 10px 10px 0;text-align: left;width: 154px;
    }
    #sort_id{
         -moz-appearance: none;background: rgba(0, 0, 0, 0) url("http://img2.isou365.cn/paimai/yunying/images/sanjiao.jpg") no-repeat scroll 130px 5px;border: 1px solid #d7d7d7;color: #666;float: left;
    font-family: "微软雅黑";font-size: 12px;height: 26px;line-height: 26px;margin: 0 10px 10px 0;text-align: left;width: 154px;
    }
    #status{
         -moz-appearance: none;background: rgba(0, 0, 0, 0) url("http://img2.isou365.cn/paimai/yunying/images/sanjiao.jpg") no-repeat scroll 130px 5px;border: 1px solid #d7d7d7;color: #666;float: left;
    font-family: "微软雅黑";font-size: 12px;height: 26px;line-height: 26px;margin: 0 10px 10px 0;text-align: left;width: 154px;
    }
</style>
</head>
<include file="Public/common_header" />
<div class="mian">
    <include file="Public/sidebar"  menu="xtgl.yygl" />
    <div class="mianR">
        <h3 class="cha">app应用管理</h3>
        <div class='carousel'>
            <form id="searchFrom">
                <select name="sort_id" id="sort_id">
                    <option value="">请选择平台</option>
                    <?php foreach ($sort_id as $k => $v): ?>
                        <option value="{$k}">{$v}</option>
                    <?php endforeach ?>
                </select>
                <select name="driver" id="driver">
                    <option value="">请选择类型</option>
                    <?php foreach ($driver as $key => $value): ?>
                        <option value="{$key}">{$value}</option>
                    <?php endforeach ?>
                </select>
                <select name="status" id="status">
                    <option value="">请选择状态</option>
                    <option value="0">已下线</option>
                    <option value="1">已上线</option>
                </select>
                <input type="button" value="查询" name="focus_search" class="focus-btn"  />
            </form>
            <span style ="float:right;margin-right:20px;"><input type="button" value="上传app应用" onclick="location.href = '/AppPublish/add'" class="new_carousel_btn" style="width:130px" /></span>
                
        </div>
        <div class="yuList">
            <div class="listBox" id="listBox"></div>
        </div>
    </div>
    <div class="clear"></div>
    <script type="text/javascript">
        //获取url中的参数
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null)
                return unescape(r[2]);
            return null; //返回参数值
        }
        get_list();
        function get_list() {
            var url = mkUrl();
            var p = getUrlParam('p');
            if (p != null) {
                var purl = "?p=" + p;
            } else {
                var purl = "?p=1";
            }
            $.get("/AppPublish/app_list/" + purl, url, function (data) {
                $("#listBox").html(data);
            }, "html");
        }
        function get_page(p) {
            var url = mkUrl();
            $.get("/AppPublish/app_list/" + encodeURI("p/" + p), url, function (data) {
                $("#listBox").html(data);
            }, "html");
        }

        $("input[name='focus_search']").click(function () {
            get_list();
        });

        function mkUrl() {
            var url = "";
            var sort_id = $("#sort_id option:selected").val();
            var driver = $("#driver option:selected").val();
            var status = $("#status option:selected").val();
            if (sort_id) {
                url += '&sort_id=' + sort_id;
            }
            if (driver) {
                url += '&driver=' + driver;
            }
            if (status) {
                url += '&status=' + status;
            };
            return url;
        }

    function ci_op(id,op_type){
    var post_data = {id:id,op_type:op_type};
    $.post('/AppPublish/ci_op',post_data,function(res){
        if(res.code==200){
            delay_alert('操作成功!');
            setTimeout(function(){
                location.href='/AppPublish/index';
            },300);
        }else{
            delay_alert(res.msg);
        }
    },'json');
    return false;
};
    </script>
    <include file="Public/foot" />
